package com.yearno.kotlinbaseframe.ui.main

import android.os.Bundle
import androidx.lifecycle.Observer
import com.yearno.baseframe.base.BaseFragment
import com.yearno.kotlinbaseframe.databinding.FragmentMainBinding

/**
 * A placeholder fragment containing a simple view.
 */
class PlaceholderFragment : BaseFragment<FragmentMainBinding, PageViewModel>() {

    override fun viewModel() = PageViewModel::class.java

    override fun initViewModel(vm: PageViewModel) {
        vm.text.observe(this, Observer<String> {
            viewBinding?.sectionLabel?.text = it
        })
        vm.setIndex(arguments?.getInt(ARG_SECTION_NUMBER) ?: 1)
    }

    override fun getVB() = FragmentMainBinding.inflate(layoutInflater, baseBinding?.root, true)

    companion object {
        /**
         * The fragment argument representing the section number for this
         * fragment.
         */
        private const val ARG_SECTION_NUMBER = "section_number"

        /**
         * Returns a new instance of this fragment for the given section
         * number.
         */
        @JvmStatic
        fun newInstance(sectionNumber: Int): PlaceholderFragment {
            return PlaceholderFragment().apply {
                arguments = Bundle().apply {
                    putInt(ARG_SECTION_NUMBER, sectionNumber)
                }
            }
        }
    }

    override fun initView() {
    }

    override fun loadDate() {
    }




}